package com.wanpinghui.supplier.user.company.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wanpinghui.supplier.R;
import com.wanpinghui.wphlibrary.model.user.bean.CompanyBean;
import com.yunshl.yunshllibrary.recyclerview.BaseRecyclerViewAdapter;

/**
 * Created by tg596 on 2018/2/3.
 */

public class CompanyNameAdapter extends BaseRecyclerViewAdapter<CompanyBean,CompanyNameAdapter.CompanyNameViewHolder> {

    public CompanyNameAdapter(Context context) {
        super(context);
    }

    @Override
    public CompanyNameViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_auto_company_name,parent,false);
        return new CompanyNameViewHolder(view);
    }

    @Override
    public void onBindViewHolder(CompanyNameViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        holder.tv_name.setText(datas.get(position).getCompany_name());
    }

    @Override
    public int getItemCount() {
        return datas == null? 0 : datas.size();
    }

    class CompanyNameViewHolder extends RecyclerView.ViewHolder {

        TextView tv_name;

        public CompanyNameViewHolder(View itemView) {
            super(itemView);
            tv_name = (TextView) itemView.findViewById(R.id.tv_name);
        }
    }
}
